"use strict";
cc._RF.push(module, '66bdd/YznFAa5zfaCtJDJ3h', 'GetGallery');
// script/standar/utils/GetGallery.ts

"use strict";
// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var Facade_1 = require("../../../libs/lightMVC/core/Facade");
var HttpUtils_1 = require("../../../libs/lightMVC/util/HttpUtils");
var API_1 = require("../../API");
var PlayerModel_1 = require("../../model/PlayerModel");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var GertGallery = /** @class */ (function (_super) {
    __extends(GertGallery, _super);
    function GertGallery() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    // LIFE-CYCLE CALLBACKS:
    // onLoad () {}
    // update (dt) {}
    GertGallery.prototype.jumpUrl = function () {
        var player = Facade_1.Facade.getInstance().getModel(PlayerModel_1.default).getPlayer();
        var param = {
            uid: player.uid,
            wechat_id: player.wechatid
        };
        HttpUtils_1.default.Post(API_1.default.wechat_bind_user, param, function (err, res) {
            if (!err) {
                var t_response = JSON.parse(res);
                if (t_response.code == 200) {
                    if (confirm("是否跳转到你的美术馆")) {
                        // console.log("跳转");
                        history.go(-100);
                        var url = API_1.default.my_gallery + player.openid;
                        window.location.replace(url);
                    }
                    else {
                        history.go(-100);
                        window.location.reload();
                        // console.log("关闭");
                    }
                }
                else {
                    alert("领取失败");
                }
            }
        });
    };
    GertGallery = __decorate([
        ccclass
    ], GertGallery);
    return GertGallery;
}(cc.Component));
exports.default = GertGallery;

cc._RF.pop();